package com.airy.highSpeed.service.impl;

import com.airy.highSpeed.dao.oracle.FlowTrafficDao;
import com.airy.highSpeed.entity.FlowTrafficEntity;
import com.airy.highSpeed.service.FlowTrafficService;
import com.airy.highSpeed.utils.PageUtils;
import com.airy.highSpeed.utils.Query;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service("flowTrafficService")
public class FlowTrafficServiceImpl extends ServiceImpl<FlowTrafficDao, FlowTrafficEntity> implements FlowTrafficService {

    @Autowired
    FlowTrafficDao flowTrafficDao;

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<FlowTrafficEntity> page = this.page(
                new Query<FlowTrafficEntity>().getPage(params),
                new QueryWrapper<FlowTrafficEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public List<FlowTrafficEntity> findAll() {
        return flowTrafficDao.findAll();
    }

    @Override
    public List<FlowTrafficEntity> find(String shijian, String bianhao) {
        return flowTrafficDao.find(shijian,bianhao);
    }

    @Override
    public List<FlowTrafficEntity> findBystartTimeAndTollStationIdAndFlage1(String thisWeekDateLastOneWeek, String thisWeekDateLastTwoWeek, String thisWeekDateLastThreeWeek, String thisWeekDateLastFourWeek, String tollStationId) {
        return flowTrafficDao.findBystartTimeAndTollStationIdAndFlage1(thisWeekDateLastOneWeek,thisWeekDateLastTwoWeek,thisWeekDateLastThreeWeek,thisWeekDateLastFourWeek,tollStationId);
    }

    @Override
    public List<FlowTrafficEntity> findBystartTimeAndTollStationIdAndFlage2(String thisWeekDateLastOneWeek, String thisWeekDateLastTwoWeek, String thisWeekDateLastThreeWeek, String thisWeekDateLastFourWeek, String tollStationId) {
        return flowTrafficDao.findBystartTimeAndTollStationIdAndFlage2(thisWeekDateLastOneWeek,thisWeekDateLastTwoWeek,thisWeekDateLastThreeWeek,thisWeekDateLastFourWeek,tollStationId);
    }

    @Override
    public List<FlowTrafficEntity> findBySTARTTIMEAndTOLLSTATIONID(String startTime, String tollStationId) {
        return flowTrafficDao.findBySTARTTIMEAndTOLLSTATIONID(startTime,tollStationId);
    }

}